using System.Collections.Generic;
using UnityEngine;

public class EOTDREWRITE_FountainColor : MonoBehaviour
{
	[Header("Settings")]
	public List<SpriteRenderer> spriteRenderers = new List<SpriteRenderer>();

	public Gradient gradient;

	public float speed = 1f;

	private float gradientTime;

	public List<float> originalDarknesses = new List<float>();

	private void Start()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		foreach (SpriteRenderer spriteRenderer in spriteRenderers)
		{
			if ((Object)(object)spriteRenderer != (Object)null)
			{
				Color color = spriteRenderer.color;
				float grayscale = ((Color)(ref color)).grayscale;
				originalDarknesses.Add(grayscale);
			}
			else
			{
				originalDarknesses.Add(1f);
			}
		}
	}

	private void LateUpdate()
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		gradientTime += speed * Time.deltaTime;
		if (gradientTime > 1f)
		{
			gradientTime -= 1f;
		}
		Color val = gradient.Evaluate(gradientTime);
		Color color = default(Color);
		for (int i = 0; i < spriteRenderers.Count; i++)
		{
			SpriteRenderer val2 = spriteRenderers[i];
			if ((Object)(object)val2 != (Object)null)
			{
				float num = originalDarknesses[i];
				((Color)(ref color))._002Ector(val.r * num, val.g * num, val.b * num, val2.color.a);
				val2.color = color;
			}
		}
	}
}
